package structures.grammar;

import structures.table.symboltable.NonTerminalInfo;
import structures.table.symboltable.TerminalItemInfo;
import structures.table.symboltable.TerminalType;

public class GrammarReaderDummy implements GrammarReader{

	@Override
	public Grammar parse(String fileName) {
		Grammar grammar = new Grammar();
        
        NonTerminalInfo E = new NonTerminalInfo("E");
        NonTerminalInfo T = new NonTerminalInfo("T");
        NonTerminalInfo F = new NonTerminalInfo("F");
        TerminalItemInfo id = new TerminalItemInfo("id", TerminalType.IDENTIFIER);
        TerminalItemInfo add = new TerminalItemInfo("+", TerminalType.PUNCTUATOR);
        TerminalItemInfo mul = new TerminalItemInfo("*", TerminalType.PUNCTUATOR);
        TerminalItemInfo opBrace = new TerminalItemInfo("(", TerminalType.PUNCTUATOR);
        TerminalItemInfo clBrace = new TerminalItemInfo(")", TerminalType.PUNCTUATOR);
        
        Rule rule1, rule2, rule3, rule4, rule5, rule6;
        
        rule1 = new Rule(E, new ItemList(E, add, T));
        rule2 = new Rule(E, new ItemList(T));
        rule3 = new Rule(T, new ItemList(T, mul, F));
        rule4 = new Rule(T, new ItemList(F));
        rule5 = new Rule(F, new ItemList(opBrace, E, clBrace));
        rule6 = new Rule(F, new ItemList(id));
        
        grammar.put(rule1);
        grammar.put(rule2);
        grammar.put(rule3);
        grammar.put(rule4);
        grammar.put(rule5);
        grammar.put(rule6);
        
        return grammar;
	}

}
